;
import $ from "jquery";
import '../css/reset.css';
import "../css/iconfont.css";

import header from "../components/header/header";
import banner from "../components/banner/banner";
import footer from "../components/footer/footer";

import indexModel from "../models/index";
import {BANNER} from "../utils/config";
import Banner from "../modules/banner";

(function($){
    const $app = $("#app"),
        $container = $("<div class='container'></div>");

    const getData = new indexModel(),
        {navData,bannerList} = getData.getNavData();

    const init = ()=>{
        render();
        loadModules()
    };

    function render(){
        console.log(navData);
        let headerComponent = header(navData).tpl();
        let bannerComponent = banner(bannerList).tpl();
        let footerComponent = footer().tpl();
        $container.append(headerComponent);
        $container.append(bannerComponent);
        $container.append(footerComponent);
        $app.append($container);
    }

    function loadModules(){
        new Banner(BANNER).init();
    }

    init()
})($);

